package cn.cupk.logsystem.log.strategypattren;

import cn.cupk.logsystem.log.LogRecord;
import cn.cupk.logsystem.log.strategypattren.Formatter;

import java.time.ZoneId;
import java.time.ZonedDateTime;

public class SimpleFormatter extends Formatter {
    @Override
    public String format(LogRecord record) {
        ZonedDateTime zdt = ZonedDateTime.ofInstant(record.getInstant(), ZoneId.systemDefault());
        return String.format("%s [%s] %s: %s\n",
                zdt,
                record.getLoggerName(),
                record.getLevel(),
                record.getMessage());
    }
}
